import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:series_play/comm/base/base_state.dart';
import 'package:series_play/generated/assets.dart';
import 'package:series_play/widget/app_color.dart';
import 'package:series_play/widget/app_image.dart';
import 'package:series_play/widget/app_refresh_view.dart';
import 'package:series_play/widget/app_text.dart';

import 'controller/wallet_reward_record_controller.dart';

class WalletRewardRecordPage extends StatefulWidget {
  const WalletRewardRecordPage({super.key});

  @override
  State<WalletRewardRecordPage> createState() => _WalletRewardRecordPageState();
}

class _WalletRewardRecordPageState
    extends
        BaseControllerState<
          WalletRewardRecordPage,
          WalletRewardRecordController
        > {
  @override
  Widget buildPage(BuildContext context) {
    return AppRefreshListView(
      padding: const EdgeInsets.all(16).w,
      listController: mController,
      itemBuilder: (context, index) {
        return Container(
          padding: const EdgeInsets.all(16).w,
          decoration: BoxDecoration(
            color: const Color(0xff292B34).withValues(alpha: 0.5),
            borderRadius: BorderRadius.circular(10).r,
          ),
          child: Row(
            children: [
              Column(
                mainAxisSize: MainAxisSize.min,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  AppText.title('任务奖励', color: AppColor.white),
                  4.verticalSpace,
                  AppText.secondary(
                    '2022.01.01 10:00:00',
                    color: AppColor.white_40,
                    fontSize: 12,
                  ),
                ],
              ),
              const Spacer(),
              AppText('+100', color: AppColor.white, fontSize: 26),
              10.horizontalSpace,
              AppImage.assetsWith15(Assets.imagesIcGold),
              16.horizontalSpace,
            ],
          ),
        );
      },
      separatorBuilder: (context, index) {
        return 10.verticalSpace;
      },
      onRefresh: mController.onRefreshing,
      onLoad: mController.onLoadingMore,
    );
  }

  @override
  createController() {
    return WalletRewardRecordController();
  }

  @override
  bool showDefaultBackground() {
    return true;
  }

  @override
  String getTitle() {
    return '奖励金币领取记录';
  }
}
